home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.arizona.edu / ftp.cs.arizona.edu.tar / ftp.cs.arizona.edu / icon / newsgrp / group00b.txt / 000132_icon-group-sender_Tue Oct 31 09:25:55 2000.msg < prev    next >
Internet Message Format  |  2001-01-03  |  3KB

  1. Return-Path: <icon-group-sender>
  2. Received: (from root@localhost)
  3.     by baskerville.CS.Arizona.EDU (8.11.1/8.11.1) id e9VGN4U00515
  4.     for icon-group-addresses; Tue, 31 Oct 2000 09:23:04 -0700 (MST)
  5. Message-Id: <200010311623.e9VGN4U00515@baskerville.CS.Arizona.EDU>
  6. Date: Tue, 31 Oct 2000 09:12:29 -0600
  7. From: "Charles Hethcoat" <CHETHCOA@oss.oceaneering.com>
  8. To: <icon-group@cs.arizona.edu>
  9. Subject: Re: How would the experts handle this...??
  10. Content-Disposition: inline
  11. X-Guinevere: 1.0.13 ; Oceaneering Int'l
  12. X-MIME-Autoconverted: from quoted-printable to 8bit by baskerville.CS.Arizona.EDU id e9VFBw328403
  13. Errors-To: icon-group-errors@cs.arizona.edu
  14. Status: RO
  15. Content-Length: 1981
  16.  
  17. >>> <symbiot@my-deja.com> 00-10-30 1:13:49 PM >>> wrote:
  18. > But, be that as it may, I'm curious as to how those "in the know" would
  19. handle this problem in a more "icon-esque" fashion.
  20.  
  21. Not that I claim Olympian status or anything, but here is my 30-minute implementation of my understanding of your problem statement (a number of questions were left unspecified).
  22.  
  23. I did use a sentinel character '@' as a 27th letter, which could be criticized as not a fully ascii-clean solution, but then I also assumed only letters count, and that 'A' is equivalent to 'a', so there is no possibility of a collision in this case.  You do get extra output including this "letter" and its neighbors.
  24.  
  25. The output style is my own invention.  The center letter in parentheses.  On its left are its left neighbors, and on the right are its right neighbors.  I could sort by center letter, but I was getting tired and was ready for a beer.
  26.  
  27. ----------------------------------8<----------------------------------------8<--------------------------------------------
  28. # connect - what letters connect?
  29.  
  30. procedure main()
  31.     l := table('')
  32.     r := table('')
  33.     nonletter := &ascii -- &lcase -- '@'
  34.     every line := !&input | "@@" do
  35.         every c := map(!line) do {
  36.             if any(nonletter, c) then
  37.                 next
  38.             pred2 := \pred | '@'
  39.             pred := \this | '@'
  40.             this := c
  41.             l[pred] ++:= pred2
  42.             r[pred] ++:= this
  43.         }
  44.     every i := key(l) do {
  45.         every writes(!l[i] | "(" | i | ")" | !r[i])
  46.         write()
  47.     }
  48.     exit(0)
  49. end
  50. ----------------------------------8<----------------------------------------8<--------------------------------------------
  51.  
  52. When run on the first paragraph above, you get this:
  53.  
  54. ei(c)il
  55. eimnruy(s)imoptw
  56. u(@)@
  57. t(h)aei
  58. mrs(p)eilr
  59. bdhilmprtuvw(e)acdfilmnrst
  60. efisuy(m)beopsy
  61. bnoqty(u)@emnrst
  62. gmo(b)elu
  63. eopu(r)aeops
  64. n(g)bo
  65. gimnrsty(o)bflnrtuy
  66. is(w)ei
  67. en(d)ei
  68. abceilop(l)aely
  69. aefnostuy(t)aehiotu
  70. @(@)n
  71. ehilnrt(a)ilntv
  72. acdefhpstwy(i)aceflmnosw
  73. f(q)u
  74. flmno(y)imostu
  75. eio(f)imqty
  76. @aeiou(n)adgostuy
  77. a(v)e
  78.  
  79. Charles Hethcoat
  80.  
  81.